/*
 * @Date         : 2022-06-07 18:49:55
 * @LastEditors  : zu1662
 * @LastEditTime : 2022-07-04 21:37:36
 * @Description  : 鉴权配置项
 * 
 * Copyright © 2022 by zu1662, All Rights Reserved. 
 */
import { registerAs } from "@nestjs/config";

export default registerAs(
  "auth",
  (): Record<string, any> => ({
    jwt: {
      accessToken: {
        secretKey: process.env.AUTH_JWT_ACCESS_TOKEN_SECRET_KEY || "123456",
        expirationTime: process.env.AUTH_JWT_ACCESS_TOKEN_EXPIRED || "30m", // recommendation for production is 30m
        notBeforeExpirationTime: "0", // keep it in zero value
      },

      refreshToken: {
        secretKey: process.env.AUTH_JWT_REFRESH_TOKEN_SECRET_KEY || "123456000",
        expirationTime: "7d", // Token失效时间。recommendation for production is 7d
        expirationTimeRememberMe: process.env.AUTH_JWT_REFRESH_TOKEN_EXPIRED || "30d", // recommendation for production is 30d
        notBeforeExpirationTime: '0' || "30m", // Token生效时间。recommendation for production is 30m
      },
    },

    password: {
      saltLength: 8,
    },
  })
);
